/****************************************************
 * @class WorkFlowLog
 * @extends Ext.grid.GridPanel
 ***************************************************/
	WorkFlowLog = Ext.extend(Ext.grid.GridPanel,{
		cm: null,
		store: null,
		condition: null,
		constructor: function(config){
			Ext.apply(this,config);
			
			this.condition = {};
			
			this.cm = new Ext.grid.ColumnModel([
				new Ext.grid.RowNumberer(),
				{header:"状态", dataIndex:"status", width:100, renderer:hilite, sortable:false},
				{header:"处理人", dataIndex:"hander", width:120, renderer:hilite, sortable:false},
				{header:"代理人", dataIndex:"attorney", width:100, renderer:hilite, sortable:false},
				{header:"接收/送出", dataIndex:"received", width:100, renderer:hilite, sortable:false},
				{header:"意见", dataIndex:"comment", width:300, renderer:hilite, sortable:false}
			]);
						
			this.store = new Ext.data.Store({
			    baseParams: this.condition, 
			    proxy: new Ext.data.HttpProxy({
			    	method: 'POST',
					url: '/pdm/dcc/getWorkFlow.htm'
				}),
		        reader: new Ext.data.JsonReader({
					 totalProperty: 'totalProperty',
					 root: 'root',
					 id: 'approvalRecorde_ID'
				},[
					{name: 'approvalRecorde_ID'},
					{name: 'status'},
					{name: 'sender'},
					{name: 'hander'},
					{name: 'attorney'},
					{name: 'received'},
					{name: 'comment'},
					{name: 'lineType'},
					{name: 'deal'}
				])
			});
						
			WorkFlowLog.superclass.constructor.call(this, {
				loadMask: {msg: "数据载入中"},
				store: this.store,
				cm: this.cm,
				anchor: '98%',
				//autoHeight: true,
				autoDestroy: true,
				autoScroll: true,
				stripeRows: true,
				viewConfig: {forceFit: true}
			});
			
		},
		load: function(c){
			this.condition.orderNumber = c;
			this.store.load();
		}
	});
	
	function hilite(value, metadata, record)
	{ 
	    var type = record.data.deal;
		metadata.attr = 'style="white-space:normal;"'; 
		if (type == 1) {
			return '<span style="color:red;">' + renderGridStr(value) + '</span>';
		}
		else if (type == 2) {
			return '<span style="color:blue;">' + renderGridStr(value) + '</span>';
		}
		return value; 
	}
	
/****************************************************
 * @class WorkFlowWindow
 * @extends Ext.grid.GridPanel
 ***************************************************/
	WorkFlowWindow = Ext.extend(Ext.Window, {
		logPnl: null,
		constructor: function(config){
			Ext.apply(this, config);
			
			this.logPnl = new WorkFlowLog();
			
			WorkFlowWindow.superclass.constructor.call(this, {
				title: "流程日志",
				width: 640,
				height: 320,
				modal: true,
				border: false,
				layout: 'fit',
				closeAction: 'close',
				autoDestroy: true,
				items: [this.logPnl]
			});
		},
		load: function(c){
			this.logPnl.load(c);
		}
	});
	
